package com.surelution.projects.gard.core

import com.surelution.projects.gard.domain.Department;
import com.surelution.projects.gard.domain.Patrol;
import com.surelution.projects.gard.domain.PatrolClock;
import com.surelution.projects.gard.domain.Poi;

class DepartmentDailyPatrolVo {

	Department department
	
	List<Poi> pois
	
	HashMap<PatrolClock, DepartmentClockPatrolVo> clocks
	
	public DepartmentDailyPatrolVo(Department dept, List<PatrolClock> clcks) {
		department = dept
		clocks = new HashMap<PatrolClock, DepartmentClockPatrolVo>()
		if(clcks) {
			clcks.each {clock ->
				if(!clocks[clock]) {
					clocks.add(clock, new DepartmentClockPatrolVo(dept))
				}
			}
		}
	}
	
	public void put(List<Patrol> patrols) {
		if(patrols) {
			patrols.each { patrol ->
				if(patrol.poi.department.id == department.id) {
					clocks[patrol.clock].put(patrol)
				}
			}
		}
	}
}
